package com.cuit.qx.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.cuit.qx.bean.WeatherStation;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @Author:wjd
 * @Description:
 * @date:Created in 16:46 2020/9/17
 * @Modified By:
 */
@Mapper
public interface WeatherStationMpper extends BaseMapper<WeatherStation> {

    // 根据id单条修改站点信息
    int updateWeatherId(WeatherStation weatherStation);

    // 根据id批量修改站点信息
    int updateWeatherForeach(List<WeatherStation> weatherStations);


    // 根据站号查询
    List<WeatherStation> selectWeatherByStationNumber(List<String> stationNumber);

    // 根据站点id删除站点信息
    int deleteWeatherById(@Param("id") String id);

    // 根据站点id批量删除站点信息
    int deleteWeatherByIds(String[] id);

    // 查询站号是否重复
    int selectWeatherStationNumber(String stationNumber);

    @Select("SELECT station_number,station_name,station_address FROM weather_station WHERE state = '1'")
    List<WeatherStation> getBySateWeather();

    // 根据站号、站名、区县模糊查询和站点类型查询
    List<WeatherStation> selectFoggyWeather(@Param("pageNo") Integer pageNo, @Param("pageSize") Integer pageSize,
                                            @Param("stationNumber") String stationNumber,
                                            @Param("stationName") String stationName,
                                            @Param("stationCounty") String stationCounty,
                                            @Param("stationType") String stationType);

    // 根据站号、站名、区县模糊查询和站点类型查询总条数
    int selectFoggyWeatherNum(@Param("stationNumber") String stationNumber,
                              @Param("stationName") String stationName,
                              @Param("stationCounty") String stationCounty,
                              @Param("stationType") String stationType);

    @Select("select station_county from weather_station GROUP BY station_county")
    List<String> getCounty();

    @Select("select * from weather_station")
    List<Map<String, Object>> getMapStieAll();
}
